package ast

func NewRootSimpleNode() Node {
    return NewSimpleNode(nil, Program, "start")
}

func NewSimpleNode(parent Node, typ Type, text string) Node {
    return &simpleNode{
        parent: parent,
        typ:    typ,
        text:   text,
    }
}

type simpleNode struct {
    parent   Node
    children []Node
    typ      Type
    text     string
}

func (s *simpleNode) Parent() Node {
    return s.parent
}

func (s *simpleNode) Children() []Node {
    return s.children
}

func (s *simpleNode) Type() Type {
    return s.typ
}

func (s *simpleNode) Text() string {
    return s.text
}

func (s *simpleNode) AddChildren(node Node) {
    s.children = append(s.children, node)
}
